/** 模块A */
const moduleA = {
  state: {
    text: "hello"
  },
  mutations: {
    addText(state, txt) {
      // 这里的 `state` 对象是模块的局部状态
      state.text += txt;
    }
  },

  actions: {
    setText({ commit }) {
      commit("addText", " world");
    }
  },

  getters: {
    getText(state) {
      return state.text + "!";
    }
  }
};

export default moduleA;
